import axios from '../http/htttp.js'
import qs from 'qs'
// <!-- 优惠券管理 -->
// 渲染列表
export function Copunlist (Renderlist) {
  return axios({
    method: 'get',
    params: {
      _gp: 'admin.coupon',
      _mt: 'queryCouponByTitle',
      ...Renderlist
    }
  })
}
// 添加和修改
export function Coupunaddupdate (data) {
  return axios({
    method: 'post',
    params: {
      _gp: 'admin.coupon',
      _mt: data._mt,
      ...data
    }
  })
}
// 删除
export function Coupundel (id) {
  return axios({
    method: 'post',
    params: {
      _gp: 'admin.coupon',
      _mt: 'deleteCoupon',
      id: id
    }
  })
}
// 修改用户状态
export function CoupStatus (data) {
  return axios({
    method: 'post',
    data: qs.stringify({
      _gp: 'admin.coupon',
      _mt: 'updateCouponStatus',
      ...data
    })
  })
}
// 获取spu树
export function Couptree () {
  return axios({
    method: 'get',
    params: {
      _gp: 'admin.category',
      _mt: 'categoryTree'
    }
  })
}
